package io.renren.event;

import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @Auther: 63461
 * @Date: 2019/2/13 21:07
 * @Description:
 */
@Service
public class BaseListener implements ApplicationListener {

    @Override
    public void onApplicationEvent(ApplicationEvent applicationEvent) {
        if (applicationEvent instanceof BaseEvent) {
            BaseEvent baseEvent = (BaseEvent)applicationEvent;
            Map<String, Object> eventMap = baseEvent.getEventMap();
            System.out.println("监听到事件: " + eventMap.get("eventName"));
        }
    }
}
